package basic.study.wantOffer.chapter3;

/**
 * @ClassName Problem27
 * @Description
 * @Company inspur
 * @Author Kevin
 * @Date 2020/5/15 9:59
 * @Version 1.0
 * 二叉树的镜像
 */
public class Problem27 {
    void MirrorRecursively(BinaryTreeNode node) {
        if (node == null) return;
        if (node.left == null && node.right == null) return;

        BinaryTreeNode temp = node.left;
        node.left = node.right;
        node.right = temp;

        if (node.left != null) {
            MirrorRecursively(node.left);
        }
        if (node.right != null) {
            MirrorRecursively(node.right);
        }
    }
}
